package com.kitty.spring.annotationdriven.configuration;

import com.kitty.spring.annotationdriven.beans.Person;
import com.kitty.spring.annotationdriven.typefilter.MyTypeFilter;
import org.springframework.context.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

/**
 * @Description
 * @Author SHEN
 * @Date 2020/12/6
 */
@Configuration
@ComponentScans({
        @ComponentScan(value = "com.kitty.spring.annotationdriven",excludeFilters = {
                //@ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class,Service.class})
                @ComponentScan.Filter(type=FilterType.CUSTOM,classes = {MyTypeFilter.class})
        },useDefaultFilters = false)
})

/**
 * ComponentScans：里面可以包含多个ComponentScan
 * ComponentScan：配置spring的包扫描；
 *  includeFilters：使用过滤规则，包含指定规则的文件需要将默认的规则禁用掉（useDefaultFilters = false）才会生效;
 *  excludeFilters：不包含指定的过滤规则，使用该规则不需要将默认的规则禁用；
 *      FilterType.CUSTOM:使用自定义过滤规则，useDefaultFilters = false
 */


public class BeanConfig {

    @Bean
    public Person person(){
        return new Person("张三",24,"大三子");
    }


}
